<?php

include('steps.php');

class datending {

    var $memory = array();
    private $steps = array();

    public function addstep($step, $varname = null) {
	$step->mem($varname);
        $stepcount = $this->getstepcount();
        $this->steps[$stepcount] = $step;
    }

    public function getstepcount() {
        return count($this->steps);
    }

    public function run() {
        $stepcount = $this->getstepcount();
        if($stepcount > 0) {
            $transform = $this->steps[0]->transform(new data());
            for($i=1;$i<$stepcount;$i++) {
                $transform = $this->steps[$i]->transform($transform);
            }
        }
    }
}
?>
